/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.isd.venta.modelo;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import com.isd.inventario.modelo.Deposito;
import com.isd.inventario.modelo.Producto;
import com.isd.inventario.modelo.Sector;

/**
 *
 * @author ctrosch
 */
@Entity
@DiscriminatorValue("A")
public class ItemProductoVenta extends ItemMovimientoVenta {

    @JoinColumns({
        @JoinColumn(name = "VTRMVI_TIPPRO", referencedColumnName = "STMPDH_TIPPRO", nullable = false, insertable=true, updatable=true),
        @JoinColumn(name = "VTRMVI_ARTCOD", referencedColumnName = "STMPDH_ARTCOD", nullable = false, insertable=true, updatable=true)
    })
    @ManyToOne(optional=false)
    private Producto producto;

    //Deposito
    @JoinColumn(name = "VTRMVI_DEPOSI", referencedColumnName = "STTDEH_DEPOSI", nullable = true)
    @ManyToOne(optional=false)
    private Deposito deposito;

    //Sector
    @JoinColumns({
        @JoinColumn(name = "VTRMVI_DEPOSI", referencedColumnName = "STTDEI_DEPOSI", nullable = false, insertable=false, updatable=false),
        @JoinColumn(name = "VTRMVI_SECTOR", referencedColumnName = "STTDEI_SECTOR", nullable = false)
    })
    @ManyToOne
    private Sector sector;

    public Producto getProducto() {
        return producto;
    }

    public void setProducto(Producto producto) {
        this.producto = producto;
    }

    public Deposito getDeposito() {
        return deposito;
    }

    public void setDeposito(Deposito deposito) {
        this.deposito = deposito;
    }

    public Sector getSector() {
        return sector;
    }

    public void setSector(Sector sector) {
        this.sector = sector;
    }

}
